import { get, post } from "./request";
class Warn {
  // 查询所有预警恢复和未恢复的数量
  async postWarnType(data) {
    const res = post("middle/klt/home/warnType");
    return res;
  }
  // 获取信息
  async getInfo() {
    const res = get("cms/user/information");
    return res;
  }
  // 查询所有预警恢复和未恢复的数量
  async getInformation(data) {
    const res = post("middle/klt/home/warnRestore", data);
    return res;
  }
  // 查询所有预警响应和未响应的数量
  async getStoreCount(data) {
    const res = post("middle/klt/home/warnResponse", data);
    return res;
  }
  // 响应确认
  async responseOk(id) {
    const res = get(`middle/klt/warn/response/${id}`);
    return res;
  }
  // 报警列表
  async getWarnList(data) {
    const res = post(`middle/klt/warn/search`, data);
    return res;
  }
  // 项目
  async getProject() {
    const res = get("middle/klt/home/project");
    return res;
  }
  // 报警详情
  async getWarnInfo(id) {
    const res = get(`middle/klt/warn/detail/${id}`);

    return res;
  }
  // 最新报警
  async postWarnNew(data) {
    console.log(data, "999");
    const res = post(`middle/klt/home/warnNew`, data);

    return res;
  }
  // 当天预警列表
  async getCurrentWarn() {
    const res = get("cms/gas/warn/getCurrentWarn");
    return res;
  }

  // 查询当天预警数量
  async getAllCurrentWarnCount() {
    const res = get("cms/gas/warn/getAllCurrentWarnCount");
    return res;
  }

  // 预警占比
  async warnCountByStation(start, end) {
    const res = get(`cms/gas/warn/warnCountByStation`, { start, end });
    return res;
  }
  // 预警区域占比
  async getAllCurrentWarn(start, end) {
    const res = get(`cms/gas/warn/warnCountByArea`, { start, end });
    return res;
  }

  // 最新预警
  async getNewWarnList() {
    const res = get("cms/warn/getCurrentWarn");
    return res;
  }

  async getRawdata(deviceId, deviceType, start, end) {
    const res = get(
      `/cms/data/rawdata?deviceId=${deviceId}&device_type=${deviceType}&start_time=${start}&end_time=${end}`
    );
    return res;
  }
  // 添加预警
  async adddata(gasNub, oilNub) {
    const res = get(`/cms/warn/creatWarn?gasNub=${gasNub}&oilNub=${oilNub}`);
    return res;
  }
}

export default new Warn();
